Virtualization includes computation virtualization, network virtualization, and storage virtualization. The storage virtualization is used to provide a storage service to a virtual machine. Performance of the storage service mainly depends on an access speed to a storage medium and overheads of a storage software stack. With development of storage hardware in recent years, a high-speed storage medium such as a solid-state drive (SSD), a non-volatile memory (NVM) express (NVMe), or a flash gradually appears. The access speed to the storage medium is accelerated to an ns level from an ms level of a mechanical disk. As a result, a great challenge is brought to the storage software stack.
A conventional storage software stack provides a storage service to a user mode application program in an interrupt return manner and using a system call entry. A storage software stack of a conventional physical machine includes a file system, a generic block layer, an input/output (I/O) scheduling layer, a small computer system interface (SCSI) layer, and the like. The file system provides a convenient storage management interface to a user. The generic block layer provides a universal I/O processing manner, including a synchronization processing method, an asynchronization processing method, an interrupt processing method, or the like to various physical storage mediums. The I/O scheduling layer sorts and combines I/O instructions, optimizes a mechanical disk addressing time at the cost of software computation, and develops a related scheduling function such as quality of service (QoS) later. The SCSI layer is classified into three layers, an SCSI upper layer, an SCSI middle layer, and an SCSI lower layer. A SCSI protocol or a unified interface is provided such that a physical machine can conveniently use different types of storage hardware.
However, in a virtualization scenario, there may be a virtualized storage software stack in addition to a storage software stack of an operating system (OS). The virtualized storage software stack mainly includes a front-end driver, a back-end storage service process, and a virtual machine monitor (VMM). The front-end driver interacts with the back-end storage service process using a virtualization technology in order to transmit an I/O request. The VMM provides a basic capability such as memory management, interrupt injection, enter and exit, or notification wake-up. A kernel-based virtual machine (KVM) is used as an example. A storage I/O procedure in virtualization is shown in FIG. 2. For an I/O request, first, the I/O request is delivered from an application in the virtual machine to a kernel of the virtual machine using a system call, then passes through a storage software stack of the virtual machine, and finally is put in a device queue (for example, an I/O ring of virtio) of a virtual disk. Afterward, virtual machine exit is triggered by writing a specific port, and a hypervisor layer (for example, a KVM module in FIG. 2) intercepts the request. Finally, by waking up QEMU, the request is sent to a QEMU process for processing. After the QEMU is woken up, the request is delivered to a storage software stack on a host side using a system call again, and is finally sent to a device queue of a physical storage device after being processed by the storage software stack on the host side. By writing in a register, the physical storage device is instructed to process the I/O request. After completing processing, the physical storage device notifies a software stack on the host side of an I/O completion event in an interrupt injection manner, and finally wakes up asynchronous I/O (aI/O) of user mode QEMU to perform handle listening. The QEMU makes a result obtained after processing pass through a completion queue (for example, the I/O ring of the virtio) of a virtual storage device again. An interrupt is injected into the virtual machine using the KVM. Finally, a virtual machine OS processes the interrupt, and finally returns the interrupt to a user mode application.
It can be learned from the above that in a storage virtualization scenario, a processing process of a storage software stack is relatively complex. As a result, read/write request processing is time-consuming, and storage performance is affected. In particular, as the access speed to the storage medium continuously increases and the overheads of the storage software stack are increasingly apparent, a percentage of a delay of the storage software stack to an entire I/O delay is 19.3% in an SSD, and a percentage of overheads of the storage software stack in a higher-speed double data rate (DDR) NVM medium has reached 94.1%. As a result, the access speed to the storage medium is seriously affected, and the storage software stack becomes a bottleneck for storage performance improvement.